/*
 * Copyright (c) 2011, Julien Lamy
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 * Redistributions of source code must retain the above copyright notice,
 * this list of conditions and the following disclaimer.
 *
 * Redistributions in binary form must reproduce the above copyright
 * notice, this list of conditions and the following disclaimer in the
 * documentation and/or other materials provided with the distribution.
 *
 * Neither the name of the project's author nor the names of its
 * contributors may be used to endorse or promote products derived from
 * this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
 * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 */

#ifndef a04185c2_145c_4f96_ba04_01b152d2321c
#define a04185c2_145c_4f96_ba04_01b152d2321c

#include <iosfwd>

#include <QString>

#include "config.h"

/**
 * @brief Type of information a DataObject may hold.
 */
namespace DataObjectType
{
    enum Type
    {
        TITLE = 1,
        LOCATION = 2,
        ALBUM = 3,
        ARTIST = 4,
        GENRE = 5,
        FILETYPE = 6,
        EQ_SETTING = 7,
        COMMENT = 8,
        CATEGORY = 9,
        COMPOSER = 12,
        GROUPING = 13,
        DESCRIPTION = 14,
        PODCAST_ENCLOSURE_URL = 15,
        PODCAST_RSS_URL = 16,
        CHAPTER_DATA = 17,
        SUBTITLE = 18,
        SHOW_NAME = 19,
        EPISODE_NUMBER = 20,
        TV_NETWORK = 21,
        ALBUM_ARTIST = 22,
        SORT_ARTIST = 23,
        KEYWORDS = 24,
        SORT_TITLE = 27,
        SORT_ALBUM = 28,
        SORT_ALBUM_ARTIST = 29,
        SORT_COMPOSER = 30,
        SORT_SHOW_NAME = 31,
        SMART_PLAYLIST_DATA = 50,
        SMART_PLAYLIST_RULES = 51,
        LIBRARY_PLAYLIST_INDEX = 52,
        LIBRARY_PLAYLIST_INDEX_JUMP_TABLE = 53,
        PLAYLIST = 100,
        ALBUM_LIST_ALBUM = 200,
        ALBUM_LIST_ARTIST = 201,
        ALBUM_LIST_SORT_ARTIST = 202,
        ALBUM_LIST_PODCAST_URL = 203,
        ALBUM_LIST_SHOW_NAME = 204,
    };
}

/**
 * @brief Leaf element of the iTunes database.
 */
template<typename T>
class DataObject
{
public :

    DataObject();
    DataObject(DataObjectType::Type type, T const & value);

    DataObjectType::Type type;
    T value;
};

template<typename T>
std::istream & operator>>(std::istream & stream, DataObject<T> & object);

template<>
std::istream & operator>>(std::istream & stream, DataObject<QString> & object);

#include "dataobject.txx"

#endif // a04185c2_145c_4f96_ba04_01b152d2321c
